

import {useState,useEffect} from 'react'
import axios from 'axios'
interface IsShowResult {
  message:string,
  status:string
}
const useURLLoader = (url:string,deps:any[] = []):[IsShowResult,boolean]=>{
  const [data,setData] = useState<any>(null)
  const [loading,setLoading] = useState<boolean>(false)
  useEffect(()=>{
    setLoading(true)
    axios.get(url).then(result=>{
      setData(result.data)
    })
  },deps)
  return [data as IsShowResult,loading]
}

export default useURLLoader
